<?php
echo '<table cellspacing=0 cellpadding=3 ><tr bgcolor="'.$colourtoprow.'">';

$query='SELECT * FROM tbldashboard2';
$result1 = mysql_query($query);
while($row1 = mysql_fetch_array($result1))
{
 echo '<td>'.$row1[Select].'</td>';
}
echo '<td>Not Assigned</td>';
$result = mysql_query("SELECT * FROM tblUsers WHERE Username!='systemadmin'");
while($row = mysql_fetch_array($result))
{
echo '<td>'.$row[Name].'</td>';
}
echo '<td>All Open</td><td>1st Line</td><td>2nd Line</td></tr><tr>';

$query='SELECT * FROM tbldashboard2';
$result1 = mysql_query($query);
while($row1 = mysql_fetch_array($result1))
{
switch($row1[Closed])
    {
case(Open);
    $row1[Closed]='';
    break; 
case(Closed);
    $row1[Closed]='checked';
    break; 
    }

mysql_query("SELECT * FROM tblJobs WHERE status LIKE '$row1[Status]' AND LogNumber LIKE '$row1[LogNumber]' AND Requestor LIKE '$row1[Requestor]' AND Subject LIKE '$row1[Subject]' AND Proirty LIKE '$row1[Proirty]' AND Closed LIKE '$row1[Closed]' AND Assigned LIKE '$row1[Assigned]' AND Line LIKE '$row1[Line]' AND Project LIKE '$row1[Project]' AND Due LIKE '$row1[Due]' AND Branch LIKE '$row1[Branch]' AND Department LIKE '$row1[Department]' AND `Private` LIKE '$row1[Private]'");

    echo "<td><b>", mysql_affected_rows() ,"</b></td>";
}

mysql_query("Select * From tblJobs where Assigned='Not Assigned' And Closed=' ' ");
echo "<td><b>", mysql_affected_rows() ,"</b></td>";

$result = mysql_query("SELECT * FROM tblUsers WHERE Username!='systemadmin'");
while($row = mysql_fetch_array($result))
{
mysql_query("Select * From tblJobs where Assigned='$row[Name]' And Closed=' ' AND Project = 'Helpdesk' ");
echo "<td><b>", mysql_affected_rows() ,"</b></td>";
}
mysql_query("Select * From tblJobs where Closed=' ' AND Project Like 'Helpdesk' ");
echo "<td><b>", mysql_affected_rows() ,"</b></td>";

mysql_query("Select * From tblJobs where Closed=' ' AND Line='1' AND Project Like 'Helpdesk' ");
echo "<td><b>", mysql_affected_rows() ,"</b></td>";

mysql_query("Select * From tblJobs where Closed=' ' AND Line='2'AND Project Like 'Helpdesk' ");
echo "<td><b>", mysql_affected_rows() ,"</b></td>";

echo '</tr></table>';

?>
